package com.qys.livesMall.shop.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.qys.livesMall.shop.modal.entity.SeckillGoods;
import com.qys.livesMall.shop.modal.query.QuerySeckillGoodsApp;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author gmx
 * @since 2023-07-03
 */
public interface SeckillGoodsMapper extends BaseMapper<SeckillGoods> {
    Page<SeckillGoods> queryGoods(Page<SeckillGoods> page, @Param("data")QuerySeckillGoodsApp data);
    @Select("SELECT\n" +
            "\ta.shop_id\n" +
            "FROM\n" +
            "\th2_shop_goods_info a\n" +
            "\tJOIN h2_shop_goods_sku b ON a.id = b.shop_goods_id\n" +
            "\tWHERE b.sku_id=#{skuId} AND a.`status`=TRUE AND is_delete =1")
    List<Long> getShopId(@Param("skuId") Long skuId);
}
